﻿#pragma once

#include "../../Shared/Enums.h"
#include <string>
#include <vector>
#include "../../stringhelper.h"

//C# TO C++ CONVERTER NOTE: Forward class declarations:
namespace Server::MirDatabase { class ConquestArcherInfo; }
namespace Server::MirDatabase { class ConquestGateInfo; }
namespace Server::MirDatabase { class ConquestWallInfo; }
namespace Server::MirDatabase { class ConquestSiegeInfo; }
namespace Server::MirDatabase { class ConquestFlagInfo; }

using namespace Server::MirEnvir;

namespace Server::MirDatabase
{
    class ConquestInfo
    {
    public:
        int Index = 0;
        bool FullMap = false;
        Point *Location;
        unsigned short Size = 0;
        std::string Name;
        int MapIndex = 0;
        int PalaceIndex = 0;
        std::vector<int> ExtraMaps = std::vector<int>();
        std::vector<ConquestArcherInfo*> ConquestGuards = std::vector<ConquestArcherInfo*>();
        std::vector<ConquestGateInfo*> ConquestGates = std::vector<ConquestGateInfo*>();
        std::vector<ConquestWallInfo*> ConquestWalls = std::vector<ConquestWallInfo*>();
        std::vector<ConquestSiegeInfo*> ConquestSieges = std::vector<ConquestSiegeInfo*>();
        std::vector<ConquestFlagInfo*> ConquestFlags = std::vector<ConquestFlagInfo*>();

        int GuardIndex = 0;
        int GateIndex = 0;
        int WallIndex = 0;
        int SiegeIndex = 0;
        int FlagIndex = 0;

        unsigned char StartHour = 0;
        int WarLength = 60;

    private:
        int counter = 0;

    public:
        ConquestType Type = ConquestType::Request;
        ConquestGame Game = ConquestGame::CapturePalace;

        bool Monday = false;
        bool Tuesday = false;
        bool Wednesday = false;
        bool Thursday = false;
        bool Friday = false;
        bool Saturday = false;
        bool Sunday = false;

        //King of the hill
        Point *KingLocation;
        unsigned short KingSize = 0;

        //Control points
        std::vector<ConquestFlagInfo*> ControlPoints = std::vector<ConquestFlagInfo*>();
        int ControlPointIndex = 0;

        virtual ~ConquestInfo()
        {
            delete Location;
            delete KingLocation;
        }

        ConquestInfo();

        ConquestInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();
    };

    class ConquestSiegeInfo
    {
    public:
        int Index = 0;
        Point *Location;
        int MobIndex = 0;
        std::string Name;
        int RepairCost = 0;

        virtual ~ConquestSiegeInfo()
        {
            delete Location;
        }

        ConquestSiegeInfo();

        ConquestSiegeInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();


    };

    class ConquestWallInfo
    {
    public:
        int Index = 0;
        Point *Location;
        int MobIndex = 0;
        std::string Name;
        int RepairCost = 0;

        virtual ~ConquestWallInfo()
        {
            delete Location;
        }

        ConquestWallInfo();

        ConquestWallInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();


    };

    class ConquestGateInfo
    {
    public:
        int Index = 0;
        Point *Location;
        int MobIndex = 0;
        std::string Name;
        int RepairCost = 0;

        virtual ~ConquestGateInfo()
        {
            delete Location;
        }

        ConquestGateInfo();

        ConquestGateInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();


    };

    class ConquestArcherInfo
    {
    public:
        int Index = 0;
        Point *Location;
        int MobIndex = 0;
        std::string Name;
        unsigned int RepairCost = 0;

        virtual ~ConquestArcherInfo()
        {
            delete Location;
        }

        ConquestArcherInfo();

        ConquestArcherInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();


    };

    class ConquestFlagInfo
    {
    public:
        int Index = 0;
        Point *Location;
        std::string Name;
        std::string FileName = std::string::Empty;

        virtual ~ConquestFlagInfo()
        {
            delete Location;
        }

        ConquestFlagInfo();

        ConquestFlagInfo(BinaryReader *reader);

        void Save(BinaryWriter *writer);

        std::string ToString();
    };
}
